home *** CD-ROM | disk | FTP | other *** search
/ Master Visual Basic 3 / Master Visual Basic 3 (SAMS Publishing) (1994).ISO / mvprog / original / ch19 / speaker.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-06-11  |  8.9 KB  |  292 lines

  1. VERSION 2.00
  2. Begin Form frmSpeaker 
  3.    BackColor       =   &H00008080&
  4.    Caption         =   "The Speaker Program"
  5.    ClientHeight    =   3330
  6.    ClientLeft      =   420
  7.    ClientTop       =   1650
  8.    ClientWidth     =   9000
  9.    ForeColor       =   &H00000000&
  10.    Height          =   3735
  11.    Icon            =   SPEAKER.FRX:0000
  12.    Left            =   360
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   3330
  15.    ScaleWidth      =   9000
  16.    Top             =   1305
  17.    Width           =   9120
  18.    Begin CheckBox chkAutoRepeat 
  19.       BackColor       =   &H00008080&
  20.       Caption         =   "&Auto Repeat"
  21.       Enabled         =   0   'False
  22.       Height          =   255
  23.       Left            =   3120
  24.       TabIndex        =   13
  25.       Top             =   3000
  26.       Width           =   1455
  27.    End
  28.    Begin OptionButton optWav3 
  29.       BackColor       =   &H00008080&
  30.       Caption         =   "3"
  31.       Height          =   375
  32.       Left            =   360
  33.       TabIndex        =   12
  34.       Top             =   2760
  35.       Width           =   495
  36.    End
  37.    Begin OptionButton optWav2 
  38.       BackColor       =   &H00008080&
  39.       Caption         =   "2"
  40.       Height          =   255
  41.       Left            =   360
  42.       TabIndex        =   11
  43.       Top             =   2520
  44.       Width           =   495
  45.    End
  46.    Begin OptionButton optWav1 
  47.       BackColor       =   &H00008080&
  48.       Caption         =   "1"
  49.       ForeColor       =   &H00000000&
  50.       Height          =   375
  51.       Left            =   360
  52.       TabIndex        =   10
  53.       Top             =   2160
  54.       Value           =   -1  'True
  55.       Width           =   495
  56.    End
  57.    Begin Frame Frame2 
  58.       BackColor       =   &H00008080&
  59.       Caption         =   "WAV File:"
  60.       ForeColor       =   &H00000000&
  61.       Height          =   1335
  62.       Left            =   120
  63.       TabIndex        =   9
  64.       Top             =   1920
  65.       Width           =   1095
  66.    End
  67.    Begin CheckBox chkMultitask 
  68.       BackColor       =   &H00008080&
  69.       Caption         =   "&Multitasking"
  70.       ForeColor       =   &H00000000&
  71.       Height          =   255
  72.       Left            =   1440
  73.       TabIndex        =   8
  74.       Top             =   3000
  75.       Width           =   1455
  76.    End
  77.    Begin TEGOMM TegommPC 
  78.       BorderStyle     =   0  'None
  79.       DeviceType      =   ""
  80.       FileName        =   ""
  81.       Height          =   330
  82.       Left            =   5400
  83.       pcSpeed         =   100
  84.       pcTaskInterval  =   0
  85.       RecordMode      =   0  'Insert
  86.       Shareable       =   0   'False
  87.       Silent          =   0   'False
  88.       TabIndex        =   7
  89.       Tempo           =   0
  90.       Top             =   3000
  91.       UpdateInterval  =   0
  92.       Width           =   3510
  93.    End
  94.    Begin CommandButton cmdExit 
  95.       BackColor       =   &H00808080&
  96.       Caption         =   "E&xit"
  97.       Height          =   975
  98.       Left            =   5280
  99.       TabIndex        =   6
  100.       Top             =   1920
  101.       Width           =   3615
  102.    End
  103.    Begin CommandButton cmdFast 
  104.       BackColor       =   &H00808080&
  105.       Caption         =   "&Fastest"
  106.       Height          =   375
  107.       Left            =   8040
  108.       TabIndex        =   5
  109.       Top             =   1080
  110.       Width           =   735
  111.    End
  112.    Begin CommandButton cmdNormal 
  113.       BackColor       =   &H00808080&
  114.       Caption         =   "&Normal"
  115.       Height          =   375
  116.       Left            =   2880
  117.       TabIndex        =   4
  118.       Top             =   1080
  119.       Width           =   735
  120.    End
  121.    Begin CommandButton cmdSlow 
  122.       BackColor       =   &H00808080&
  123.       Caption         =   "&Slowest"
  124.       Height          =   375
  125.       Left            =   240
  126.       TabIndex        =   3
  127.       Top             =   1080
  128.       Width           =   735
  129.    End
  130.    Begin HScrollBar hsbSpeed 
  131.       Height          =   495
  132.       Left            =   240
  133.       TabIndex        =   2
  134.       Top             =   480
  135.       Width           =   8535
  136.    End
  137.    Begin Frame Frame1 
  138.       BackColor       =   &H00008080&
  139.       Caption         =   "Speed"
  140.       Height          =   1455
  141.       Left            =   120
  142.       TabIndex        =   1
  143.       Top             =   120
  144.       Width           =   8775
  145.    End
  146.    Begin CommandButton cmdPlay 
  147.       BackColor       =   &H00808080&
  148.       Caption         =   "&Play"
  149.       Height          =   975
  150.       Left            =   1440
  151.       TabIndex        =   0
  152.       Top             =   1920
  153.       Width           =   3615
  154.    End
  155. Option Explicit
  156. Sub chkMultitask_Click ()
  157.     ' Enable multitasking?
  158.     If chkMultitask.Value = 1 Then
  159.        
  160.        ' Set the multitask time slice to 400 milliseconds.
  161.        TegommPC.pcTaskInterval = 400
  162.        
  163.        ' Enable the mouse during playback
  164.        TegommPC.pcMouseEnabled = True
  165.        
  166.        ' Enable the Auto Repeat check box.
  167.        chkAutoRepeat.Enabled = True
  168.     Else
  169.        
  170.        ' No multitasking.
  171.        TegommPC.pcTaskInterval = 0
  172.        
  173.        ' Disable the mouse during playback.
  174.        TegommPC.pcMouseEnabled = False
  175.        
  176.        ' Disable the Auto Repeat check box.
  177.        chkAutoRepeat.Enabled = False
  178.        ' Set the caption of the cmdPlay button to "Play".
  179.        cmdPlay.Caption = "&Play"
  180.     End If
  181. End Sub
  182. Sub cmdExit_Click ()
  183.     End
  184. End Sub
  185. Sub cmdFast_Click ()
  186.     ' Set the hsbSpeed scroll bar to maximum value.
  187.     hsbSpeed.Value = hsbSpeed.Max
  188. End Sub
  189. Sub cmdNormal_Click ()
  190.     ' Set the hsbSpeed scroll bar to normal speed value.
  191.     hsbSpeed.Value = 100
  192. End Sub
  193. Sub cmdPlay_Click ()
  194.     ' Play or Stop?
  195.     If TegommPC.Mode = 526 Then
  196.        cmdPlay.Caption = "&Play"
  197.        TegommPC.Command = "Stop"
  198.     Else
  199.        cmdPlay.Caption = "Sto&p"
  200.        TegommPC.Command = "Play"
  201.     End If
  202. End Sub
  203. Sub cmdSlow_Click ()
  204.     ' Set the hsbSpeed scroll bar to minimum value.
  205.     hsbSpeed.Value = hsbSpeed.Min
  206. End Sub
  207. Sub Form_Load ()
  208.     Dim WavFile
  209.     ' Make the multimedia control invisible.
  210.     TegommPC.Visible = False
  211.     ' Set the DeviceType property for playback of
  212.     ' WAV files through the PC speaker.
  213.     TegommPC.DeviceType = "PCSpeaker"
  214.     ' Set the FileName property.
  215.     WavFile = Left(App.Path, 2) + "\MVPROG\WAV\BOURB1M1.WAV"
  216.     TegommPC.FileName = WavFile
  217.     ' Issue an Open command.
  218.     TegommPC.Command = "Open"
  219.     ' If Open command failed, display an error message.
  220.     If TegommPC.Error <> 0 Then
  221.        MsgBox "Cannot open " + WavFile, 0, "ERROR"
  222.     End If
  223.     ' Set the Min and Max of the hsbSpeed scroll bar.
  224.     hsbSpeed.Min = 50
  225.     hsbSpeed.Max = 200
  226.     ' Set the hsbTempo scroll bar to the normal speed.
  227.     hsbSpeed.Value = 100
  228. End Sub
  229. Sub hsbSpeed_Change ()
  230.     ' Set the pcSpeed property to the current value
  231.     ' of the hsbSpeed scroll bar.
  232.     TegommPC.pcSpeed = hsbSpeed.Value
  233. End Sub
  234. Sub optWav1_Click ()
  235.     Dim WavFile
  236.     ' Set the FileName property.
  237.     WavFile = Left(App.Path, 2) + "\MVPROG\WAV\BOURB1M1.WAV"
  238.     TegommPC.FileName = WavFile
  239.     ' Issue an Open command.
  240.     TegommPC.Command = "Open"
  241.     ' If Open command failed, display an error message.
  242.     If TegommPC.Error <> 0 Then
  243.        MsgBox "Cannot open " + WavFile, 0, "ERROR"
  244.     End If
  245.     ' Set the caption of the cmdPlay button to "Play".
  246.     cmdPlay.Caption = "&Play"
  247. End Sub
  248. Sub optWav2_Click ()
  249.     Dim WavFile
  250.     ' Set the FileName property.
  251.     WavFile = Left(App.Path, 2) + "\MVPROG\WAV\STROL1M1.WAV"
  252.     TegommPC.FileName = WavFile
  253.     ' Issue an Open command.
  254.     TegommPC.Command = "Open"
  255.     ' If Open command failed, display an error message.
  256.     If TegommPC.Error <> 0 Then
  257.        MsgBox "Cannot open " + WavFile, 0, "ERROR"
  258.     End If
  259.     ' Set the caption of the cmdPlay button to "Play".
  260.     cmdPlay.Caption = "&Play"
  261. End Sub
  262. Sub optWav3_Click ()
  263.     Dim WavFile
  264.     ' Set the FileName property.
  265.     WavFile = Left(App.Path, 2) + "\MVPROG\WAV\8KENNED3.WAV"
  266.     TegommPC.FileName = WavFile
  267.     ' Issue an Open command.
  268.     TegommPC.Command = "Open"
  269.     ' If Open command failed, display an error message.
  270.     If TegommPC.Error <> 0 Then
  271.        MsgBox "Cannot open " + WavFile, 0, "ERROR"
  272.     End If
  273.     ' Set the caption of the cmdPlay button to "Play".
  274.     cmdPlay.Caption = "&Play"
  275. End Sub
  276. Sub TegommPC_Done ()
  277.     ' Did playback position reach the end of the file?
  278.     If TegommPC.Position = TegommPC.Length Then
  279.        
  280.        ' Rewind the multimedia control.
  281.        TegommPC.Command = "Prev"
  282.        
  283.        ' Play again?
  284.        If chkAutoRepeat.Value = 1 And chkMultitask.Value = 1 Then
  285.           TegommPC.Command = "Play"
  286.        Else
  287.           cmdPlay.Caption = "&Play"
  288.        End If
  289.        
  290.     End If
  291. End Sub
  292.